The WDMIDLE Sample

The WDMIDLE Sample accompanies Chapter 8 and illustrates how to arrange for the Power Manager to automatically power down a device when the device has been idle for a user-specified period.

The sample includes three components:

Building WDMIDLE

To build WDMIDLE.SYS, follow the general instructions for building a WDM sample. The Microsoft Visual C++ project file is named SYS\WDMIDLE.DSP. To build either POWCPL.CPL or TEST.EXE, follow the general instructions for building user-mode sample programs. The project files are POWCPL\POWCPL.DSP and TEST\TEST.DSP, respectively.

Testing WDMIDLE

First install WDMIDLE.SYS. Follow the general instructions for using FastInst in Windows 2000 or the Add New Hardware wizard in Windows 98. The INF file is named SYS\DEVICE.INF.

In Windows 2000, open the Power Options control panel applet. (It's called Power Management in Windows 98). There will be a page named Other devices. On this page, one instance of WDMIDLE should appear in the Devices list box. You can configure WDMIDLE to shutdown after specific periods of time, or you can request an immediate shutdown. You’ll need to look at a log of debugging messages to know when the idle shutdown actually occurs. (Either run under control of a debugger, or else use the DbgView utility from http://www.sysinternals.com/.)

You can exercise the automatic power-on feature of WDMIDLE by opening a command prompt and running TEST.EXE from the TEST\DEBUG subdirectory.